package com.example.foo.product.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.core.PageResult;
import com.example.core.Pageable;
import com.example.foo.product.model.Bag;
import com.example.foo.product.query.BagQuery;

@org.apache.ibatis.annotations.Mapper
public interface BagDao extends com.example.core.dao.BaseDao<Bag, Long> {

	public default PageResult<Bag> findBags(BagQuery bagQuery, Pageable pageable) {
		QueryWrapper<Bag> queryWrapper = createQueryWithBaseIf(bagQuery);
		//
		if (bagQuery.getState() != null) {
			queryWrapper.eq("state", bagQuery.getState());
		}
		return findPages(queryWrapper, pageable);
	}

}
